home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / etc / network / if-up.d / avahi-autoipd next >
Text File  |  2008-07-27  |  886b  |  33 lines

  1. #!/bin/sh -e
  2. # Description:      Add routes to allow communication between machines which
  3. #                   only have an IPv4LL address assigned and those which only
  4. #                   have a routable address assigned.
  5. #
  6. #                   See http://developer.apple.com/qa/qa2004/qa1357.html for
  7. #                   more information.
  8.  
  9. [ "$IFACE" != "lo" ] || exit 0
  10. case "$ADDRFAM" in
  11.   inet|NetworkManager) ;;
  12.   *) exit 0
  13. esac
  14.  
  15. case "$METHOD" in
  16.     static|dhcp|NetworkManager) ;;
  17.     *) exit 0
  18. esac
  19.  
  20.  
  21. if [ -x /bin/ip ]; then
  22.     # route already present?
  23.     ip route show | grep -q '^169.254.0.0/16[[:space:]]' && exit 0
  24.  
  25.     /bin/ip route add 169.254.0.0/16 dev $IFACE metric 1000 scope link
  26. elif [ -x /sbin/route ]; then
  27.     # route already present?
  28.     /sbin/route -n | egrep -q "^169.254.0.0[[:space:]]" && exit 0
  29.  
  30.     /sbin/route add -net 169.254.0.0 netmask 255.255.0.0 dev $IFACE metric 1000
  31. fi
  32.  
  33.